<?php
include $this->Render('header.php');
//include $this->Render('sys_menu.php');
?>


<!--S 公共顶部-->
<div id="page-north">
    <?php
		include $this->Render('nav.php');
	?>
    
    <!-- S 查询条件 -->
    <div class="admin-search-box admin-search-reset">
        <ul class="admin-search-ul">
			<?php
				if(Purview::checkPurview($this->UserConfig['Id'],array('crm','sys','role', 'add'))){
			?>
            <li>
                <a class="nc-btn-input J-jue-add" href="javascript:;"><em class="ico-jia mr5"></em>新增角色</a>
            </li>
			<?php
				}
				if(Purview::checkPurview($this->UserConfig['Id'],array('crm','sys','role', 'edit'))){
			?>
            <li>
                <a class="nc-btn-input J-jue-edit" data-uid="0" href="javascript:;"><em class="ico-xiugai mr5"></em>编辑角色</a>
            </li>
			<?php
				}
				if(Purview::checkPurview($this->UserConfig['Id'],array('crm','sys','role', 'remove'))){
			?>
            <li>
                <a class="nc-btn-input J-jue-del" data-uid="0" href="javascript:;"><em class="ico-del mr5"></em>删除角色</a>
            </li>
			<?php
				}
				if(Purview::checkPurview($this->UserConfig['Id'],array('crm','sys','role', 'packadd'))){
			?>
            <li>
                <a class="nc-btn-input J-ico-jia" href="javascript:;"><em class="ico-jia mr5"></em>新增权限包</a>
            </li>
			<?php
				}
				if(Purview::checkPurview($this->UserConfig['Id'],array('crm','sys','role', 'packedit'))){
			?>
            <li>
                <a class="nc-btn-input J-ico-xiugai" data-pid="0" href="javascript:;"><em class="ico-xiugai mr5"></em>编辑权限包</a>
            </li>
			<?php
				}
				if(Purview::checkPurview($this->UserConfig['Id'],array('crm','sys','role', 'packremove'))){
			?>
            <li>
                <a class="nc-btn-input J-ico-del" data-pid="0" href="javascript:;"><em class="ico-del mr5"></em>删除权限包</a>
            </li>
			<?php
				}
			?>
        </ul>
        <div class="clear"></div>
    </div>
    <!-- E 查询条件 -->
    
</div>
<!--E 公共顶部 -->

<!-- S 内容 -->
<style type="text/css">
	.role-box {
		height:auto;
		overflow:hidden;
		border:1px solid #e1e1e1;
	}
	.role-box-left,.role-box-main,.role-box-right {
		height:500px;
		overflow-y:scroll;
		overflow-x:hidden;
		border-right:1px solid #e1e1e1;
		float:left;
		width:33.33%;
		box-sizing:border-box;
		-webkit-box-sizing:border-box;
		-moz-box-sizing:border-box;
	}
	
	.role-box-right {
		border-right:0;
	}
	
	.role-box-right dt,.role-box-right dd {
		line-height:22px;
	}
	
	.role-box table tr td {
		height:30px;
	}
	
	.role-box input[type="radio"] {
		vertical-align:sub;
	}
	.role-box-right>dl>dd {
		padding-left:18px;
	}
	.role-box-right input[type="checkbox"] {
		vertical-align:sub;
		margin-right:5px;
	}
	
	.role-box-right>dl>dd>dl>dd {
		padding-left:38px;
	}
	.role-box-left tbody tr.on {
		background:#c0dbed	
	}
</style>
<form class="login-box-form J-ajaxForm" action="/role/update/option/save/" method="post" autocomplete="off">
<div class="role-box J-role-box">
	<div class="role-box-left J-role-box-h">
    	<table width="96%" align="center" cellpadding="0" cellspacing="0" border="0">
        	<thead>
            	<tr>
                	<td width="20%">角色编号</td>
                    <td width="20%">角色名称</td>
                    <td width="60%">备注说明</td>
                </tr>
            </thead>
            <tbody class="J-role-tbody">
				<?php
					if(!empty($this->role)) foreach($this->role as $k=>$v){
				?>
            	<tr data-rselect="<?php echo $v['r_role'];?>" data-uid="<?php echo $v['r_id'];?>" data-rname="<?php echo $v['r_name'];?>" data-rcode="<?php echo $v['r_code'];?>" data-pselect="<?php echo $v['r_package'];?>">
                	<td><?php echo $v['r_code'];?></td>
                    <td><?php echo $v['r_name'];?></td>
                    <td><?php echo $v['r_remarks'];?></td>
                </tr>
				<?php
					}
				?>
            </tbody>
        </table>
        <input type="hidden" name="r_name" value="" />
        <input type="hidden" name="r_code" value="" />
    </div>
    <div class="role-box-main J-role-box-h">
    	<table width="96%" align="center" cellpadding="0" cellspacing="0" border="0">
        	<thead>
            	<tr>
                	<td width="10%">状态</td>
                    <td width="20%">权限包编号</td>
                    <td width="30%">权限包名称</td>
                    <td width="40%">备注说明</td>
                </tr>
            </thead>
            <tbody class="J-package-tbody">
				<?php
					if(!empty($this->packer)) foreach($this->packer as $k=>$v){
				?>
            	<tr>
                	<td><input type="checkbox" value="<?php echo $v['p_id'];?>" name="r_package[]" data-role="<?php echo $v['p_role'];?>" /></td>
                	<td><?php echo $v['p_code'];?></td>
                    <td><?php echo $v['p_name'];?></td>
                    <td><?php echo $v['p_text'];?></td>
                </tr>
				<?php
					}
				?>
            </tbody>
        </table>
    </div>
    <div class="role-box-right J-role-box-h J-role-list">
    	<?php
			if(!empty($this->purview[0]['next'])) foreach($this->purview[0]['next'] as $ok => $ov){
		?>
        <dl>
        	<dt><em class="ico-arrows-on on J-ico-arrows"></em>&nbsp;<em class="ico-folder-open"></em>&nbsp;<input type="checkbox" name="r_role[]" value="<?php echo $ov['id'];?>" /><?php echo $ov['name'];?></dt>
            <dd class="J-one">
				<?php
					if(!empty($ov['next'])) foreach($ov['next'] as $sk => $sv){
				?>
            	<dl>
                	<dt>
                    	<?php
                        	if(empty($sv['next'])){
						?>
                    		<em class="ico-leaf"></em>&nbsp;
                        <?php
							}else{
						?>
                    		<em class="ico-arrows-on on J-ico-arrows"></em>&nbsp;<em class="ico-folder-open"></em>&nbsp;
                        <?php
							}
						?>
                        <input type="checkbox" name="r_role[]" value="<?php echo $sv['id'];?>" /><?php echo $sv['name'];?>
                    </dt>
                    
                    <dd class="J-parent">
                    	<dl>
							<?php
								if(!empty($sv['next'])) foreach($sv['next'] as $tk => $tv){
							?>
                        	<dd><em class="ico-leaf"></em>&nbsp;<input type="checkbox" class="J-srole" name="r_role[]" value="<?php echo $tv['id'];?>" /><?php echo $tv['name'];?></dd>
							<?php
								}
							?>
                        </dl>
                    </dd>
                </dl>
				<?php
					}
				?>
            </dd>
        </dl>
		<?php
			}
		?>
    </div>
</div>
<div class="luru-box-btn mt15" style=" float:right; padding-right:15px;">
    <input type="hidden" name="option" value="save" />
    <input type="hidden" name="id" value="" />
    <input class="btn-submit-blue fn-left mr15 J-submit" type="submit" value="提交" />
</div>
</form>
<!-- E 内容 -->
<script type="text/javascript" src="<?php echo BASE_STYLE;?>/js/role.js"></script>
<?php include $this->Render('footer.php');die(); ?>
